<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="招标项目编号">
              <a-input placeholder="请输入招标项目编号" v-model="queryParam.tenderProjectCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="相关标段（包）编号">
              <a-input placeholder="请输入相关标段（包）编号" v-model="queryParam.bidSectionCodes"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="招标编号">
                <a-input placeholder="请输入招标编号" v-model="queryParam.tenderCode"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="公告标题">
                <a-input placeholder="请输入公告标题" v-model="queryParam.noticeName"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="状态">
                <j-dict-select-tag placeholder="请选择状态" v-model="queryParam.status" dictCode="sys_common_status"/>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->


    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">


           <template v-if="record.status == 0 || record.status == 3">
              <a-divider type="vertical" />
              <a @click="handleEdit(record)">编辑</a>

              <a-divider type="vertical" />
              <a-popconfirm title="确定提交吗?" @confirm="() => handleSubmit(record)">
                <a>提交</a>
              </a-popconfirm>
            </template>
            <a v-else @click="handleDetail(record)">详情</a> 
        </span>

      </a-table>
    </div>

    <ex-tender-ann-qua-inquery-ann-modal ref="modalForm" @ok="modalFormOk"/>
  </a-card>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ExTenderAnnQuaInqueryAnnModal from './modules/ExTenderAnnQuaInqueryAnnModal'
  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  import '@/assets/less/TableExpand.less'

  export default {
    name: "ExTenderAnnQuaInqueryAnnList",
    mixins:[JeecgListMixin],
    components: {
      ExTenderAnnQuaInqueryAnnModal
    },
    data () {
      return {
        disableMixinCreated: true,
        superQueryParams:'',
        description: 'ex_tender_ann_qua_inquery_ann管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'招标项目编号',
            align:"center",
            dataIndex: 'tenderProjectCode'
          },
          {
            title:'相关标段（包）编号',
            align:"center",
            dataIndex: 'bidSectionCodes'
          },
          {
            title:'监督部门代码',
            align:"center",
            dataIndex: 'superviseDeptCode'
          },
          {
            title:'招标编号',
            align:"center",
            dataIndex: 'tenderCode'
          },
          {
            title:'公告标题',
            align:"center",
            dataIndex: 'noticeName'
          },
          {
            title:'公告发布时间',
            align:"center",
            dataIndex: 'noticeSendTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'公告截止时间',
            align:"center",
            dataIndex: 'noticeEndTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'公告类型',
            align:"center",
            dataIndex: 'bulletinType_dictText'
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'status_dictText'
          },
          {
            title:'创建时间',
            align:"center",
            dataIndex: 'createTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/exTenderAnnQuaInqueryAnn/exTenderAnnQuaInqueryAnn/list",
          delete: "/exTenderAnnQuaInqueryAnn/exTenderAnnQuaInqueryAnn/delete",
          deleteBatch: "/exTenderAnnQuaInqueryAnn/exTenderAnnQuaInqueryAnn/deleteBatch",
          exportXlsUrl: "/exTenderAnnQuaInqueryAnn/exTenderAnnQuaInqueryAnn/exportXls",
          importExcelUrl: "exTenderAnnQuaInqueryAnn/exTenderAnnQuaInqueryAnn/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    created () {
      let projectId = this.$route.query.projectId
      if (projectId) {
        this.disableMixinCreated = true;
        this.superQueryParams = `[{field:'projectId',val:${projectId},dbType:'String',rule:'eq'}]`
        this.loadData()
      } else {
        this.loadData()
      }
      this.getSuperFieldList();
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'tenderProjectCode',text:'招标项目编号',dictCode:''})
        fieldList.push({type:'string',value:'bidSectionCodes',text:'相关标段（包）编号',dictCode:''})
        fieldList.push({type:'string',value:'unifiedDealCodes',text:'统一交易标识码',dictCode:''})
        fieldList.push({type:'string',value:'superviseDeptName',text:'监督部门名称',dictCode:''})
        fieldList.push({type:'string',value:'superviseDeptCode',text:'监督部门代码',dictCode:''})
        fieldList.push({type:'string',value:'tenderCode',text:'招标编号',dictCode:''})
        fieldList.push({type:'string',value:'noticeName',text:'公告标题',dictCode:''})
        fieldList.push({type:'string',value:'noticeContent',text:'公告内容',dictCode:''})
        fieldList.push({type:'date',value:'noticeSendTime',text:'公告发布时间'})
        fieldList.push({type:'string',value:'noticeMedia',text:'公告发布媒体',dictCode:''})
        fieldList.push({type:'string',value:'url',text:'公告源url',dictCode:''})
        fieldList.push({type:'string',value:'noticeNature',text:'公告性质',dictCode:''})
        fieldList.push({type:'string',value:'bulletinType',text:'公告类型',dictCode:''})
        fieldList.push({type:'date',value:'docGetStartTime',text:'招标文件/资格预审文件获取时间'})
        fieldList.push({type:'date',value:'docGetEndTime',text:'招标文件/资格预审文件获取截止时间'})
        fieldList.push({type:'string',value:'tenderDocGetMethod',text:'招标文件/资格预审文件获取方法',dictCode:''})
        fieldList.push({type:'date',value:'bidDocReferEndTime',text:'投标文件/资格预审申请文件递交截止时间'})
        fieldList.push({type:'date',value:'bidOpenTime',text:'开标时间'})
        fieldList.push({type:'BigDecimal',value:'docPrice',text:'文件售价',dictCode:''})
        fieldList.push({type:'string',value:'docPriceCurrency',text:'文件售价币种',dictCode:''})
        fieldList.push({type:'string',value:'docPriceUnit',text:'文件售价单位',dictCode:''})
        fieldList.push({type:'string',value:'bidDocReferMethod',text:'投标文件/资格预审申请文件递交方法',dictCode:''})
        fieldList.push({type:'string',value:'syndicatedFlag',text:'是否允许联合体投标',dictCode:''})
        fieldList.push({type:'string',value:'isPostpone',text:'是否延期开标',dictCode:''})
        fieldList.push({type:'string',value:'bidOpenMethod',text:'开标方式/文件开启方式',dictCode:''})
        fieldList.push({type:'string',value:'qualType',text:'评审办法',dictCode:''})
        fieldList.push({type:'string',value:'tenderCodeType',text:'招标人代码类型',dictCode:''})
        fieldList.push({type:'string',value:'tendererCode',text:'招标人代码',dictCode:''})
        fieldList.push({type:'string',value:'tendererName',text:'招标人名称',dictCode:''})
        fieldList.push({type:'string',value:'tendererAddress',text:'招标人地址',dictCode:''})
        fieldList.push({type:'string',value:'tendererContactor',text:'招标人联系人',dictCode:''})
        fieldList.push({type:'string',value:'tendererPhoneNumber',text:'招标人联系电话',dictCode:''})
        fieldList.push({type:'string',value:'tendererEmail',text:'招标人电子邮箱',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyCodeType',text:'招标代理机构代码类型',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyCode',text:'招标代理机构代码',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyName',text:'招标代理机构名称',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyAddress',text:'招标代理机构地址',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyContactor',text:'招标代理机构联系人',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyPhoneNumber',text:'招标代理机构联系电话',dictCode:''})
        fieldList.push({type:'string',value:'tenderAgencyEmail',text:'招标代理机构电子邮箱',dictCode:''})
        fieldList.push({type:'string',value:'otherContent',text:'其他内容',dictCode:''})
        fieldList.push({type:'string',value:'bulletinDuty',text:'公告发布责任人',dictCode:''})
        fieldList.push({type:'string',value:'bulletinDutyCodeType',text:'交易平台验证责任人',dictCode:''})
        fieldList.push({type:'string',value:'attachmentCode',text:'附件关联标识号',dictCode:''})
        fieldList.push({type:'string',value:'platformCode',text:'交易系统标识码',dictCode:''})
        fieldList.push({type:'date',value:'noticeEndTime',text:'公告截止时间'})
        fieldList.push({type:'string',value:'status',text:'状态',dictCode:'sys_common_status'})
        fieldList.push({type:'date',value:'createTime',text:'创建时间'})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
